 /*
 *  Brain.h
 *  
 *
 *  Created by Daniel Condon on 23/08/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef BRAIN_GUARD
#define BRAIN_GUARD

#include <vector>

#include "../CreatureControl/Virus.h"
#include "../Vec.h"

using namespace std;

class Brain{
private:
	double dRange;
	vector<Brain*> others;
	//int PredatorRank;
	
	bool isAlive;
	double vel;
	Vec pos, dir, forw;
	double size;
	Vec seperation, alignment, cohesion;
	double seperation_threshold;
	double detectRange;
	bool infected;
	Virus virus;
	bool spread;
	
	int timeNearInfected;
	
	void Kill();
public:
	//objID is to ensure the creature doesnt add itself to the nearby creature list
 	int objID;
	
	/*Default Constructor
	 Does nothing
	 */
	Brain();
	
	/*Minimal Constructor
	 Params:
	 Parameter(0) : size of the object
	 Pre : Parameter(0) not null or negative
	 */
	Brain(double);
	
	/*Secondary Constructor
	 Params:
	 Parameter(0) : creatures x coordinate
	 Parameter(1) : creatures y coordinate
	 Parameter(2) : size of the object
	 Parameter(3) : objID
	 Pre : Parameter(0&1&2) not null
	 */
	Brain(double, double, double, int);
	
	/*Secondary Constructor
	 Params:
	 Parameter(0) : creatures x coordinate
	 Parameter(1) : creatures y coordinate
	 Parameter(2) : size of the object
	 Parameter(3) : objID
	 Pre : Parameter(0&1&2) not null
	 */
	Brain(Vec, double, int);
	~Brain();
	
	Vec getPos();
	Vec getDir();
	Vec getForw();
	
	void setSize(double);
	double getSize();
	
	double getRange();
	
	bool getAlive();
	
	void AddSeperation(int, double);
	void AddAlignment(int);
	void AddCohesion(int);

	bool canAdd(Brain*);
	
	void AddNearby(vector<Brain*>);
	void Clear();
	void Clean();
	void Sense();
	void Move();
	
	int infectionStatus();
	void activateVirus();
	void giveVirus();
	void contractVirus();
	void InfectOthers();
	
	vector<Brain*> connected();
};

#endif